package com.test.branch;

public class IfTest2 {
    public static void main(String[] args) {
        //if分支练习-红绿灯
        pass();
    }

    public static void pass() {
        boolean red = true;
        boolean yellow = false;
        boolean green = false;

        if (red){
            System.out.println("红灯亮，停车！");
        } else if (yellow) {
            System.out.println("黄灯亮，准备！");
        } else if (green) {
            System.out.println("绿灯亮，行！");
        } else {
            System.out.println("灯坏了，停下来！");
        }
    }
}
